﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.IO;

namespace TERP.WaterClient.Common
{
	public class ErrorMsgHandler
	{
		private static ErrorMsgHandler _instance;
		/// <summary>
		/// 
		/// </summary>
		public static ErrorMsgHandler Instance
		{
			get
			{
				if (_instance == null)
					_instance = new ErrorMsgHandler();
				return _instance;
			}
		}

		private JvProperties _propMsg;

		private ErrorMsgHandler(){
			_propMsg = new JvProperties();
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="stream"></param>
		public void LoadMessage(Stream stream)
		{
			_propMsg.Load(stream);
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		public string GetMessage(string key){
			return _propMsg.GetProperty(key, "Unknown message");
		}
	}
}
